package com.danceforyou.common.service.impl;

import com.danceforyou.common.service.GeneratorService;
import com.danceforyou.common.dao.GeneratorDAO;
import com.danceforyou.common.vo.SqlColumnVO;
import com.danceforyou.common.vo.SqlTableVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("generatorService")
public class GeneratorServiceImpl implements GeneratorService {
    @Resource
    private GeneratorDAO generatorDAO;

    @Transactional(readOnly = true)
    public List<SqlTableVO> listTables() {
        return generatorDAO.listTables();
    }

    @Transactional(readOnly = true)
    public SqlColumnVO getPriColumnsByTableName(String tableName) {
        return generatorDAO.getPriColumnsByTableName(tableName);
    }

    @Transactional(readOnly = true)
    public List<SqlColumnVO> listColumnsByTableName(String tableName) {
        return generatorDAO.listColumnsByTableName(tableName);
    }
}